package online.takemehand.fx;

import javafx.application.Application;
import javafx.application.HostServices;
import javafx.scene.Cursor;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.layout.*;
import javafx.stage.Stage;

import java.io.InputStream;
import java.net.URL;


public class Main4 extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        HostServices hostServices = getHostServices();
        hostServices.showDocument("www.baidu.com");


        InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("仓库清单.png");


        Button button = new Button("按钮");
        button.setPrefWidth(200);
        button.setPrefHeight(200);
        Image image = new Image(resourceAsStream);

        button.setBackground(new Background(new BackgroundImage(image, BackgroundRepeat.NO_REPEAT,BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT)));
        button.setCursor(Cursor.HAND);

        Group group = new Group();
        group.getChildren().add(button);

        Scene scene = new Scene(group);
        primaryStage.setScene(scene);
        primaryStage.setWidth(1920);
        primaryStage.setHeight(1080);
        primaryStage.show();
    }
}
